/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.diplomka.servicelayer.gamelogic.resolver;

import cz.muni.fi.diplomka.servicelayer.gamelogic.manager.CityManager;
import cz.muni.fi.diplomka.servicelayer.gamelogic.manager.WorldManager;
import cz.muni.fi.diplomka.servicelayer.gamelogic.managerimpl.CityManagerImpl;
import cz.muni.fi.diplomka.servicelayer.gamelogic.managerimpl.WorldManagerImpl;
import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 * Class used for checking if game world need enlarging
 *
 * @author Jakub Kutil
 */
public class WorldResolver {

    private static WorldManager worldManager = new WorldManagerImpl();
    private static CityManager cityManager = new CityManagerImpl();

    public static void main(String[] args) throws InterruptedException {
        while (true) {

            Calendar calendar = new GregorianCalendar();

            if (calendar.get(Calendar.HOUR_OF_DAY) == 2) {
                if (cityManager.getAllCities().size() > worldManager.getWorld().size() / 100 * 8) {
                    worldManager.enlargeWorld();
                } else {
                    Thread.sleep(1000 * 60 * 60);
                }
            }
        }
    }
}
